//index.js
//获取应用实例
var app = getApp()
Page({
	data: {
		root:'',
		pagetitle:'登录',
		siteroot:app.setting.siteroot,
		att_url:app.setting.att_url,
		account:app.setting.account,
		
	},
	onReady: function (){
	},
	onShow: function (){
		var ssid=wx.getStorageSync('ssid');
		if(!ssid && !app.issession){
			app.util.session();
		}
	},
	onPullDownRefresh: function (){
		var the=this;
		var opt={};
		the.onLoad(opt);
		setTimeout(function(){
			wx.stopPullDownRefresh()
		},1000);
	},
	onLoad: function (){
		var the=this;
		wx.setNavigationBarTitle({
			  title: the.data.pagetitle
		}),
		app.util.get(app.access,function(pagedata){
			console.log(pagedata);
			the.setData({
				pagedata:pagedata,
				pagetitle:pagedata.title,
				loading:false
			});
		});
	},
	radioChange: function (e) {
		var the = this
		var pagedata= the.data.pagedata
			pagedata.item.setting = e.detail.value
		console.log(e.detail.value);
		the.setData({
				pagedata:pagedata
		});
	},
	mobile_login:function(e){
		//根据openid为用户登陆，此处尝试获取用户手机号
		app.util.post('core/member.login/wxapp_login/',e.detail,function(res){
			app.util.goback();
		});
	},
	info_login:function(e){
		//根据openid为用户登陆，此处尝试获取用户信息
		app.util.post('core/member.login/wxapp_login/',e.detail,function(res){
			console.log(res);
		});
	},
	formSubmit:function(event){
		var data=event.detail.value;
		data.login_type=1
		app.util.post('core/member.login/login/',data);
	},
  	click:function(evt){
		//用户点击事件 data.func 为方法名，data.params 为调用参数！
		var data=evt.target.dataset;
		data.login_type=1;
		app.util[data.func](data.params);
	}
});